#include <stdio.h>
#include <string.h>
typedef struct 
{
    int id;
    char name[20];
    int age;
}student;

int main()
{
    FILE *fr = fopen("文件编程","r");
    FILE *fw = fopen("test.txt","w");

    if(fr == NULL)
    {
        printf("文件打开失败!\n");
        return -1;
    }
    if(fw == NULL)
    {
        printf("文件打开失败!\n");
        return -1;
    }

    // char c = 0;
    // while((c = fgetc(fr))!=EOF)
    // {
    //     fputc(c,fw);
    // }

    //const char* s = "这是对fputs写入文件字符串的测试\n";
    // fputs(s,fw);

   //printf("%d\n",fwrite(s,1024,1,fw));


    // fclose(fr);
    // fclose(fw);



    // student stu;
    // stu.id = 1;
    // strcpy(stu.name,"zhangsan");
    // stu.age = 20;


    //把一个结构体放入文件中
    //fprintf(fw,"%d %s %d",stu.id,stu.name,stu.age);


    return 0;
}